package com.hzeport.bgs22emduty.enums;

import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * 配置模式字段 SETTING_MODE 枚举
 */
@Getter
public enum SettingModeEnum {
    SETTINGS_PAGE("1", "后台页面配置"),
    SQL_INSERT("0", "数据库插入（旧配置）")
    ;
    private final String code;
    private final String description;

    SettingModeEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public static String getDescByCode(String code) {
        if (StringUtils.isNotEmpty(code)) {
            for (SettingModeEnum myEnum : SettingModeEnum.values()) {
                if (StringUtils.equals(myEnum.getCode(), code)) {
                    return myEnum.getDescription();
                }
            }
        }
        return SQL_INSERT.getCode();
    }

}
